package org.lql.chaos.kafka.example.partition;

import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.common.Cluster;
import org.apache.kafka.common.PartitionInfo;
import org.lql.chaos.kafka.example.enums.PartitionEnum;

import java.util.List;

/**
 * @author: liangqinglong
 * @date: 2025-08-10 13:22
 * @description:
 **/
@Slf4j
public class DefaultPartitionStrategy implements CustomPartitionStrategy {

	@Override
	public String getName() {
		return PartitionEnum.DEFAULT.getName();
	}

	@Override
	public int partition(String topic, Object key, byte[] keyBytes, Object value, byte[] valueBytes, Cluster cluster) {
		log.debug("使用默认策略进行分区");
		List<PartitionInfo> partitionInfos = cluster.partitionsForTopic(topic);
		return 0;
	}
}
